﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0812045
{
    public class Bullet : VisibleGameEntity
    {
        public override VisibleGameEntity Clone()
        {

            VisibleGameEntity newObject = new Bullet();
            //Copy các thuộc tính từ this => newObject 
            newObject._nsprite = this._nsprite;
            newObject._sprite = new BulletSprite[this._nsprite];
            for (int i = 0; i < this._nsprite; i++)
            {
                newObject._sprite[i] = new BulletSprite(this._sprite[i].texture2d);
            }
            newObject.x = this.x;
            newObject.y = this.y;
            //((Bullet)newObject).nDelay = this.nDelay;
            //((Bullet)newObject).iDelay = 0;

            return newObject;
        }

        public override bool Init(ContentManager content, int n, string strResource)
        {
            // Khoi tao nhan vat
            _nsprite = 1;
            _sprite = new BaseSprite[_nsprite];
            Texture2D[] texture2D;
            texture2D = new Texture2D[n];
            for (int i = 0; i < n; i++)
                texture2D[i] = content.Load<Texture2D>(@"Bullets/" + strResource);
            _sprite[0] = new BulletSprite(texture2D);

            return true;
        }
    }
}
